package lanou3g.myfirstapp36kr.activity;

import android.content.Intent;
import android.view.KeyEvent;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

import lanou3g.myfirstapp36kr.R;
import lanou3g.myfirstapp36kr.base.BaseActivity;

/**
 * Created by dllo on 16/8/21.
 */
public class WelcomeActivity extends BaseActivity implements AnimationListener {
    private ImageView imageView = null;
    private Animation alphaAnimation = null;
    @Override
    protected int getLayout() {
        return R.layout.activity_welcom;
    }

    @Override
    protected void initView() {
        imageView = (ImageView) findViewById(R.id.welcome_image_view);
        alphaAnimation = AnimationUtils.loadAnimation(this,R.anim.welcome_alpha);
        alphaAnimation.setFillEnabled(true);
        alphaAnimation.setFillAfter(true);
        imageView.setAnimation(alphaAnimation);
        alphaAnimation.setAnimationListener(this);

    }

    @Override
    protected void initData() {

    }

    @Override
    public void onAnimationStart(Animation animation) {

    }

    @Override
    public void onAnimationEnd(Animation animation) {
        Intent intent = new Intent(this,LeadActivity.class);
        startActivity(intent);
        this.finish();

    }

    @Override
    public void onAnimationRepeat(Animation animation) {

    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK){
            return false;
        }
        return false;
    }
}
